package com.sandwich.api.apibean.v1;

import com.sandwich.admin.domain.CategoryEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class CategoryResponse {
    @ApiModelProperty(value = "pk")
    private long pk;
    @ApiModelProperty(value = "分类名称")
    private String categoryName;
    @ApiModelProperty(value = "平台pk")
    private long globalPlatformPk;
    @ApiModelProperty(value = "0 有效 1无效")
    private int status;
    @ApiModelProperty(value = "created_at")
    private long createdAt;
    @ApiModelProperty(value = "updated_at")
    private long updatedAt;

    public CategoryResponse() {
    }

    public CategoryResponse(CategoryEntity entity) {
        this.pk = entity.getPk();
        this.categoryName = entity.getName();
        this.globalPlatformPk = entity.getGlobalPlatformPk();
        this.status = entity.getStatus();
        this.createdAt = entity.getCreatedAt().getTime();
        this.updatedAt = entity.getUpdatedAt().getTime();
    }
}
